﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ICM_ReceiveItem.aspx.cs" Inherits="KPIS.GERP.GIMS.APP.APP_UI.Form.ICM_ReceiveItem" %>
<%--<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<%@ Register TagPrefix="custom" Namespace="KPIS.Customs.UI" %>--%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title></title>
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <link rel="StyleSheet" href="../../Styles/StyleSheet.css" type="text/css"/>  
    <style type="text/css">
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" >
        </asp:ScriptManager>
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript" src="../../Scripts/Common.js"></script>
            <script type="text/javascript">

            function GetValue(sender) {
                var hiddenElement = document.getElementById('<%= hdDnItemSeq.ClientID %>');
                var selectedValue = sender.get_value();
                hiddenElement.value = selectedValue;   
            }      

            function onTextChangeGeneral(sender) {
                if (sender.get_value() == "") {
                    sender.set_text("");
                }
            }
            function CollapseSelectTree() {
                var treeview = $find('<%= RadTreeView1.ClientID %>');
                var selectedNode = treeview.get_selectedNode();
                if (selectedNode != null) {
                    selectedNode.collapse();
                }
                else {
                    var firstNode = treeview.findNodeByValue("0");
                    firstNode.collapse();
                }
            }
            function ExpandSelectTree() {
                var treeview = $find('<%= RadTreeView1.ClientID %>');
                var selectedNode = treeview.get_selectedNode();
                if (selectedNode != null) {
                    selectedNode.expand();
                }
                else {
                    var firstNode = treeview.findNodeByValue("0");
                    firstNode.expand();
                }
            }
            function SeqClick(seq) {
                var hiddenElement = document.getElementById("<%= hdSeq.ClientID %>");
                hiddenElement.value = seq;
                $find("<%= RadManager1.ClientID %>").ajaxRequest(seq);
            }

            function closeRadWindow(sender, args) {
                $find("<%= RadManager1.ClientID %>").ajaxRequest('CloseWindow');
            }
            function MessageAlert(strMessageAlert) {
                window.alert(strMessageAlert);
            }
            function cancelUndock(sender, Args) {
                Args.set_cancel(true);
            }

            function setCalendarTable() {
                var tooltip = $find("<%= ToolTipDateExpired.ClientID %>");
                var calendar = $find("<%= CalendarDateExpired.ClientID %>");
                var fastNavigation = calendar._getFastNavigation();
                fastNavigation.OnToday =
                        function() {
                            var today = new Date;
                            var date = [today.getFullYear(), today.getMonth() + 1, today.getDate()];
                            calendar.selectDate(date, true);
                            fastNavigation.Popup.Hide();
                            var all_date = date.toString().split(",");
                            var year = parseInt(all_date[0]) + 543;
                            var month = all_date[1];
                            var day = all_date[2];
                            if (day.length == 1) {
                                day = '0' + day;
                            }
                            if (month.length == 1) {
                                month = '0' + month;
                            }

                            var maskText = $find("<%= txtDateExpired.ClientID %>");
                            maskText.set_value(day + month + year);
                            tooltip.hide();
                        }
            }
            function OnDateClick(calendarInstance, args) {
                var tooltip = $find("<%= ToolTipDateExpired.ClientID %>");
                var fastNavigation = calendarInstance._getFastNavigation();
                var date = args.get_renderDay().get_date().toString();
                var all_date = date.split(",");
                var year = parseInt(all_date[0]) + 543;
                var month = all_date[1];
                var day = all_date[2];
                if (day.length == 1) {
                    day = '0' + day;
                }
                if (month.length == 1) {
                    month = '0' + month;
                }

                var maskText = $find("<%= txtDateExpired.ClientID %>");
                maskText.set_value(day + month + year);
                tooltip.hide();
            }
            function OnCalendarViewChanged(sender, step) {
                var year = parseInt(sender.FocusedDate[0]) + 543;
                var month = sender.FocusedDate[1];
                document.getElementById("CalendarDateExpired_Title").innerHTML = changeMonthNumberToName(month) + " " + year;
            }
        </script>
    </telerik:RadCodeBlock>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" BackgroundPosition="None" Skin="Outlook">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxManager runat="server" ID="RadManager1" OnAjaxRequest="RadManager1_AjaxRequest">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />
                    <telerik:AjaxUpdatedControl ControlID="PanelData" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnCollapse">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="PanelLeft" LoadingPanelID="RadAjaxLoadingPanel1"/>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnSearch">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="PanelLeft" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnCancel">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="PanelLeft" LoadingPanelID="RadAjaxLoadingPanel1"/>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnUser">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="btnUser"/>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadTreeView1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />
                    <telerik:AjaxUpdatedControl ControlID="PanelData" LoadingPanelID="RadAjaxLoadingPanel1"/>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="PanelData">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />
                    <telerik:AjaxUpdatedControl ControlID="PanelData" />
                    <telerik:AjaxUpdatedControl ControlID="panelCommand" />
                </UpdatedControls>
            </telerik:AjaxSetting>  
            <telerik:AjaxSetting AjaxControlID="ShowGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelData" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="AddNew">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelData" />
                </UpdatedControls>
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="Edit">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelData" />
                </UpdatedControls>
            </telerik:AjaxSetting>          
            <telerik:AjaxSetting AjaxControlID="AddNewSave">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />
                    <telerik:AjaxUpdatedControl ControlID="panelData" />
                    <telerik:AjaxUpdatedControl ControlID="Grid" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnSelectDN">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="btnSelectDN" />
                    <telerik:AjaxUpdatedControl ControlID="hdDnItemSeq" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="panelCommand">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelCommand" />
                    <telerik:AjaxUpdatedControl ControlID="panelData" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="Delete">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="panelData" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    
    <asp:Panel ID="panelHidden" runat="server">
        <asp:HiddenField ID="hdSeq" runat="server" Value="" />
        <asp:HiddenField ID="hdDnItemSeq" runat="server" Value="" />
        <asp:HiddenField ID="hdSourceFile" runat="server" Value="" />
        <asp:HiddenField ID="hdChangeFile" runat="server" Value="" />
    </asp:Panel>
    
    <telerik:RadSplitter id="RadSplitter1" runat="server" height="460" width="1000" Skin="Office2007">
        <telerik:RadPane id="LeftPane" runat="server" width="350" Scrolling="None" Locked="true">
            <table cellpadding="0" cellspacing="0" width="100%">
                
                <tr>
                    <td>
                        <asp:Panel ID="PanelLeft" runat="server">
                            <asp:Panel ID="PanelCommandTree" runat="server">
                                <div class="bigModuleLeftTreeTab">
                                    <div class="bigModuleBottomLeftTreeTab">
                                        <table cellpadding="0" cellspacing="0">
                                            <tr class="command-list">
                                                <td class="command-item" style="border: none">
                                                    <asp:LinkButton ID="btnCollapse" runat="server" CausesValidation="false" 
                                                        CssClass="LinkButton" OnClick="btnCollapse_Click">
                                                    <img style="border:0px;vertical-align:middle;" alt="" 
                                                        src="../Image/Tree/collapse2.gif" />&nbsp;&nbsp;ซ่อนทั้งหมด
                                                    </asp:LinkButton>
                                                </td>
                                                <td class="command-item">
                                                    <telerik:RadTextBox ID="txtSearch" runat="server" Skin="Outlook" 
                                                        ToolTip="กรุณาใส่ข้อความที่ต้องการค้นหา" Width="70">
                                                    </telerik:RadTextBox>
                                                    <asp:LinkButton ID="btnSearch" runat="server" CausesValidation="false" 
                                                        CssClass="LinkButton" OnClick="btnSearch_Click">
                                                        <img style="border:0px;vertical-align:middle;" alt="" 
                                                        src="../Image/Tree/search.gif" />&nbsp;&nbsp;ค้นหา
                                                    </asp:LinkButton>
                                                </td>                                  
                                            </tr>
                                            <tr>
                                                <td colspan="3">
                                                    <asp:Panel ID="PanelSearch" runat="server" Visible="false">
                                                        <table cellpadding="0" cellspacing="0" width="100%">
                                                            <tr>
                                                                <td>
                                                                    <asp:Label ID="lblSearch" runat="server" Font-Size="Small" ForeColor="Blue" 
                                                                        Text="ผลการค้นหา : "></asp:Label>
                                                                    <asp:Label ID="lblSearch1" runat="server" Font-Size="Small" 
                                                                        Text="พบรายการเป็นจำนวน "></asp:Label>
                                                                    <asp:Label ID="lblResult" runat="server" Font-Size="Small" ForeColor="#006600"></asp:Label>
                                                                    <asp:Label ID="lblSearch2" runat="server" Font-Size="Small" Text=" รายการ"></asp:Label>
                                                                </td>
                                                                <td align="right">
                                                                    <asp:LinkButton ID="btnCancel" runat="server" CssClass="LinkButton" 
                                                                        OnClick="btnCancel_Click">
                                                                        <img style="border:0px;vertical-align:middle;" alt="" 
                                                                        src="../Image/Grid/Cancel.gif" />&nbsp;ยกเลิก
                                                                    </asp:LinkButton>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </asp:Panel>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>
                            </asp:Panel>
                            <div class="bigModuleLeftTreeTab">
                                <div class="bigModuleBottomLeftTreeTab">
                                    <asp:Panel ID="panelHeaderList" runat="server">
                                        <div class="header-grid">
                                            <asp:Label ID="lblHeaderList" runat="server" Text="รายการพัสดุ"></asp:Label>
                                            <asp:Label ID="lblReceiveSeq" runat="server" Visible="false"></asp:Label>
                                            <asp:Label ID="lblDnSeq" runat="server" Visible="false"></asp:Label>
                                        </div>
                                    </asp:Panel>
                                    <asp:Panel ID="PanelTree" runat="server" CssClass="panelWideTree" Height = "350px" ScrollBars="Auto">
                                        <telerik:RadTreeView ID="RadTreeView1" runat="server" CausesValidation="false" 
                                            CssClass="TreeView" DataFieldID="Id" DataFieldParentID="Parent_id" 
                                            DataTextField="Name" DataValueField="Id" OnNodeClick="RadTreeView1_NodeClick" 
                                            OnNodeExpand="RadTreeView1_NodeExpand" Skin="Outlook">
                                            <CollapseAnimation Duration="0" Type="None" />
                                            <ExpandAnimation Duration="0" Type="None" />
                                            <DataBindings>
                                                <telerik:RadTreeNodeBinding ImageUrlField="Image_url" />
                                            </DataBindings>
                                        </telerik:RadTreeView>
                                    </asp:Panel>
                                </div>
                            </div>
                        </asp:Panel>
                    </td>
                </tr>
            </table>
        </telerik:RadPane>
    <telerik:RadSplitBar id="RadSplitBar1" runat="server"></telerik:RadSplitBar>
    <telerik:RadPane id="PaneData" runat="server" Scrolling="None">
        <asp:Panel ID="PanelData" runat="server" >
        <table cellpadding="0" cellspacing="0" align="left">
            <tr valign="top">
                <td valign="top">
                    <asp:Panel ID="panelCommand" runat="server">
                        <div class="bigModuleRight">
                            <div class="bigModuleBottomRight">
                                <table cellpadding="0" cellspacing="0">
                                    <tr class="command-list">
                                        <td class="command-item" style="border: none">
                                            <asp:LinkButton ID="ShowGrid" runat="server" CssClass="LinkButton" onclick="ShowGrid_Click" CausesValidation="false">
                                                <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/table.gif" />&nbsp;&nbsp;แสดงข้อมูลทั้งหมด
                                            </asp:LinkButton>                        
                                        </td>
                                        <td class="command-item">
                                            <asp:LinkButton ID="AddNew" runat="server" CssClass="LinkButton" onclick="AddNew_Click">
                                                <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/AddRecord.gif" />&nbsp;&nbsp;เพิ่มข้อมูลใหม่
                                            </asp:LinkButton>
                                        </td>
                                        <td class="command-item">
                                            <asp:LinkButton ID="Edit" runat="server" CssClass="LinkButton"  visible="false" OnClick="Edit_Click">
                                                <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Edit.gif" />&nbsp;&nbsp;แก้ไขข้อมูล
                                            </asp:LinkButton>
                                        </td>
                                        <td class="command-item">
                                            <asp:LinkButton ID="Delete" runat="server" CssClass="LinkButton" OnClientClick="javascript:return confirm('ยืนยันการลบข้อมูลที่เลือก')" OnClick="Delete_Click">
                                                <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Delete.gif" />&nbsp;&nbsp;ลบข้อมูล
                                            </asp:LinkButton>
                                        </td>
                                        <td class="command-item">
                                            <asp:LinkButton ID="AddNewSave" runat="server" CssClass="LinkButton" Visible="false" onclick="AddNewSave_Click">
                                                <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cmd_Save.gif" />&nbsp;&nbsp;บันทึกข้อมูล
                                            </asp:LinkButton>
                                        </td>
                                        <td class="command-item">
                                            <asp:LinkButton ID="EditSave" runat="server" CssClass="LinkButton" Visible="false" onclick="EditSave_Click">
                                                <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cmd_Save.gif" />&nbsp;&nbsp;บันทึกข้อมูล
                                            </asp:LinkButton>
                                        </td>
                                        <td class="command-item">
                                            <asp:LinkButton ID="Cancel" runat="server" CssClass="LinkButton" Visible="false" onclick="Cancel_Click" CausesValidation="false">
                                                <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cancel.gif" />&nbsp;&nbsp;ยกเลิก
                                            </asp:LinkButton>
                                        </td>              
                                    </tr>
                                </table>
                            </div>
                        </div>        
                    </asp:Panel>
                    <div class="bigModuleRight">
                        <div class="bigModuleBottomRight">
                            <asp:Panel ID="panel1" runat="server">
                                <div class="header-grid">
                                    <asp:Label ID="Label1" runat="server" Text="รายการพัสดุ"></asp:Label>
                                </div>
                            </asp:Panel>
            <asp:Panel CssClass="panelList" runat="server" ID="panelList" ScrollBars="Auto">
                <table>
                    <tr>
                        <td align="left" width="100" valign="top">
                            <table>
                                <tr>
                                    <td>
                                        <asp:Image ID="imgPhoto" runat="server" Width="100" Height="120"></asp:Image>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td width="100%" align ="left">
                            <ul class="formListItem" id="Ul1">
                            <asp:Panel ID="AjaxPanelDnItem" runat="server">
                                <div class="formList-detail">
                                    <table>
                                        <tr>
                                            <td width = "120px">
                                                รายการตรวจรับ :
                                            </td>
                                            <td>
                                                <asp:Label runat="server" ID="lblDnItem" AssociatedControlID="cmbDnItem"></asp:Label>
                                                <telerik:RadComboBox ID="cmbDnItem" runat="server" Height="230px" Width="300px"
                                                    AutoPostBack="true" DataTextField="Descr" DataValueField="seq" />
                                            </td>
                                            <td>
                                                <asp:Button ID="btnSelectDN" runat="server" Text="เลือก" onclick="btnSelectDN_Click" />
                                                <label id="Label20" runat="server"><font color="red">*</font></label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                            </td>
                                            <td>
                                                <asp:RequiredFieldValidator ID="ValcmbDnItem" runat="server" ControlToValidate="cmbDnItem" SetFocusOnError="True" Display="Dynamic" ErrorMessage="* กรุณาระบุรายการพัสดุ *"></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </asp:Panel>   
                                <div class="formList-detail">
                                    <table>
                                        <tr>
                                            <td width = "120px">
                                                รายการพัสดุ :
                                            </td>
                                            <td>
                                                <asp:Label runat="server" ID="Label3" AssociatedControlID="cmbResItem"></asp:Label>
                                                <telerik:RadComboBox ID="cmbResItem" runat="server" 
                                                    AllowCustomText="true" EmptyMessage="< พิมพ์ที่นี่เพื่อค้นหา >" 
                                                    EnableLoadOnDemand="true" EnableVirtualScrolling="true" Height="230px" 
                                                    HighlightTemplatedItems="true" MarkFirstMatch="false" 
                                                    OnClientTextChange="onTextChangeGeneral" 
                                                    OnItemsRequested="cmbResItem_ItemsRequested"                                                                         
                                                    ShowDropDownOnTextboxClick="true" 
                                                    ShowMoreResultsBox="true" 
                                                    Width="300px">
                                                    <HeaderTemplate>
                                                        <table cellpadding="0" cellspacing="0" class="font-label">
                                                            <tr>
                                                                <td align="left" width="100px"><b>รหัสพัสดุ</b></td>
                                                                <td align="left" width="200px"><b>รายการพัสดุ</b></td>                                      
                                                            </tr>
                                                        </table>
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <asp:Table ID="tableResItem" runat="server" CellPadding="0" CellSpacing="0" CssClass="font-label">
                                                        </asp:Table>
                                                    </ItemTemplate>
                                                </telerik:RadComboBox>
                                                <label id="Label4" runat="server"><font color="red">*</font></label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                            </td>
                                            <td>
                                                <asp:RequiredFieldValidator ID="ValcmbResItem" runat="server" ControlToValidate="cmbResItem" SetFocusOnError="True" Display="Dynamic" ErrorMessage="* กรุณาระบุรายการพัสดุ *"></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            <telerik:RadAjaxPanel ID="AjaxPanelAutoJobSite" runat="server" >
                                <div class="formList-detail">
                                    <table>
                                        <tr>
                                            <td width = "120px">
                                                เบิกจ่ายอัตโนมัติ :
                                            </td>
                                            <td>
                                                <label id="Label26" runat="server">ให้หน่วยงาน : </label>
                                                <asp:Label runat="server" ID="lblToJobSite" AssociatedControlID="cmbToJobSite"></asp:Label>
                                                <telerik:RadComboBox ID="cmbToJobSite" runat="server" 
                                                    AllowCustomText="true" EmptyMessage="< พิมพ์ที่นี่เพื่อค้นหา >" 
                                                    EnableLoadOnDemand="true" EnableVirtualScrolling="true" Height="230px" 
                                                    HighlightTemplatedItems="true" MarkFirstMatch="false" 
                                                    OnClientTextChange="onTextChangeGeneral" 
                                                    OnItemsRequested="cmbToJobSite_ItemsRequested"                                                                         
                                                    ShowDropDownOnTextboxClick="true" 
                                                    ShowMoreResultsBox="true" 
                                                    Width="300px">
                                                    <HeaderTemplate>
                                                        <table cellpadding="0" cellspacing="0" class="font-label">
                                                            <tr>
                                                                <td align="left" width="100px"><b>รหัสหน่วยงาน</b></td>
                                                                <td align="left" width="200px"><b>ชื่อหน่วยงาน</b></td>                                      
                                                            </tr>
                                                        </table>
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <asp:Table ID="tableToJobSite" runat="server" CellPadding="0" CellSpacing="0" CssClass="font-label">
                                                        </asp:Table>
                                                    </ItemTemplate>
                                                </telerik:RadComboBox>
                                                <label id="Label25" runat="server"><font color="red">*</font></label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                            </td>
                                            <td>
                                                <asp:RequiredFieldValidator ID="ValcmbToJobSite" runat="server" ControlToValidate="cmbToJobSite" SetFocusOnError="True" Display="Dynamic" ErrorMessage="* กรุณาระบุหน่วยงาน *"></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </telerik:RadAjaxPanel>    
                                <div class="formList-detail">
                                    <table>
                                        <tr>
                                            <td width = "120px" valign="top">
                                                จำนวนรับเข้าคลัง :
                                            </td>
                                            <td>
                                                <asp:Label runat="server" ID="lblQty" AssociatedControlID="txtQty"></asp:Label>
                                                <telerik:RadNumericTextBox ID="txtQty" Runat="server" Width="100px" Skin="Outlook" NumberFormat-DecimalDigits="0"></telerik:RadNumericTextBox>
                                            </td>
                                            <td>
                                                <asp:Label runat="server" ID="lblUnit" AssociatedControlID="cmbUnit"></asp:Label>
                                                <telerik:RadComboBox CssClass="RadComboBox" runat="server" ID="cmbUnit" 
                                                    AllowCustomText="true" 
                                                    ShowDropDownOnTextboxClick="true"
                                                    Filter="Contains" DataTextField="Name" 
                                                    DataValueField="Seq" Width="100px" Height="150px"
                                                    EmptyMessage=".. พิมพ์ที่นี่เพื่อช่วยค้นหา .." 
                                                    LoadingMessage="กำลังโหลดข้อมูล ..." MarkFirstMatch="false" 
                                                    OnClientTextChange="onTextChangeGeneral">
                                                </telerik:RadComboBox>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                                <div class="formList-detail">
                                    <table>
                                        <tr>
                                            <td width = "120px" valign="top">
                                                ราคาต่อหน่วย :
                                            </td>
                                            <td>
                                                <asp:Label runat="server" ID="lblPrice" AssociatedControlID="txtPrice"></asp:Label>
                                                <telerik:RadNumericTextBox ID="txtPrice" Runat="server" Width="100px" Skin="Outlook">
                                                </telerik:RadNumericTextBox>
                                            </td>
                                        </tr>
                                    </table>
                                </div>        
                                <div class="formList-detail">
                                    <table>
                                        <tr>
                                            <td width = "120px">
                                                หมายเลขพัสดุ :
                                            </td>
                                            <td>
                                                <asp:Label runat="server" ID="lblSerialNumber" AssociatedControlID="txtSerialNumber"></asp:Label>
                                                <asp:TextBox CssClass="TextBox" ID="txtSerialNumber" runat="server" Visible="false" Width="100px"></asp:TextBox>
                                                <label id="Label2" runat="server"><font color="red"> * ระบบออกให้อัตโนม้ติ *</font></label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                            </td>
                                            <td>
                                                
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
                                <div class="formList-detail">
                                    <table>
                                        <tr>
                                            <td width = "150px">
                                                ประเภทค่าเสื่อม :
                                            </td>
                                            <td>
                                                <asp:Label runat="server" ID="lblDepreciationType" AssociatedControlID="cmbDepreciationType"></asp:Label>
                                                <telerik:RadComboBox ID="cmbDepreciationType" runat="server" 
                                                    AllowCustomText="true" EmptyMessage="< พิมพ์ที่นี่เพื่อค้นหา >" 
                                                    EnableLoadOnDemand="true" EnableVirtualScrolling="true" Height="230px" 
                                                    HighlightTemplatedItems="true" MarkFirstMatch="false" 
                                                    OnClientTextChange="onTextChangeGeneral" 
                                                    OnItemsRequested="cmbDepreciationType_ItemsRequested"                                                                         
                                                    ShowDropDownOnTextboxClick="true" 
                                                    ShowMoreResultsBox="true" 
                                                    Width="200px">
                                                    <HeaderTemplate>
                                                        <table cellpadding="0" cellspacing="0" class="font-label">
                                                            <tr>
                                                                <td align="left" width="200px"><b>ประเภทค่าเสื่อม</b></td>                            
                                                            </tr>
                                                        </table>
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <asp:Table ID="tableDepreciationType" runat="server" CellPadding="0" CellSpacing="0" CssClass="font-label">
                                                        </asp:Table>
                                                    </ItemTemplate>
                                                </telerik:RadComboBox>
                                                <label id="Label5" runat="server"><font color="red">*</font></label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                            </td>
                                            <td>
                                                <asp:RequiredFieldValidator ID="ValcmbDepreciationType" runat="server" ControlToValidate="cmbDepreciationType" SetFocusOnError="True" Display="Dynamic" ErrorMessage="* กรุณาระบุประเภทค่าเสื่อม *"></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </telerik:RadAjaxPanel> 
                                <div class="formList-detail">
                                    <table>
                                        <tr>
                                            <td width = "120px" valign="top">
                                                คำอธิบาย (ยี่ห้อ ขนาด ลักษณะ) :
                                            </td>
                                            <td>
                                                <asp:Label runat="server" ID="lblDescr" AssociatedControlID="txtDescr"></asp:Label>
                                                <asp:TextBox CssClass="TextBox" ID="txtDescr" runat="server" Visible="false" TextMode="MultiLine" Height="50" Width="280px" Font-Names="Microsoft Sans Serif"></asp:TextBox>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                                <div class="formList-detail">
                                    <table>
                                        <tr>
                                            <td width = "120px" valign="top">
                                                รายการสิ่งที่มาด้วยกับพัสดุ :
                                            </td>
                                            <td>
                                                <asp:Label runat="server" ID="lblAccessary" AssociatedControlID="txtAccessary"></asp:Label>
                                                <asp:TextBox CssClass="TextBox" ID="txtAccessary" runat="server" Visible="false" TextMode="MultiLine" Height="50" Width="280px" Font-Names="Microsoft Sans Serif"></asp:TextBox>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                                <div class="formList-detail">
                                    <table>
                                        <tr>
                                            <td width = "120px">
                                                วันที่หมดอายุการใช้งาน :
                                            </td>
                                            <td>
                                                <asp:Label runat="server" ID="lblDateExpired" AssociatedControlID="txtDateExpired"></asp:Label>
                                                <telerik:RadMaskedTextBox ID="txtDateExpired" runat="server" Mask=" ##/##/####" Width="75px" TextWithLiterals=" //" SelectionOnFocus="SelectAll"></telerik:RadMaskedTextBox>
                                                <asp:LinkButton ID="LinkButton3" runat="server" CssClass="LinkButton">
                                                    <img alt="" src="../Image/Icon/Calendar.gif" style="border:0px;vertical-align:middle;" />
                                                </asp:LinkButton>
                                                <telerik:RadToolTip ID="ToolTipDateExpired" runat="server" 
                                                    Animation="None" HideEvent="LeaveToolTip" 
                                                    Position="MiddleRight" ShowEvent="OnClick" Skin="Telerik" 
                                                    TargetControlID="LinkButton3" Modal="true">
                                                    <telerik:RadCalendar id="CalendarDateExpired" runat="server" 
                                                        TitleFormat="MMMM yyyy" 
                                                        EnableMultiSelect="false" 
                                                        UseRowHeadersAsSelectors="false" 
                                                        UseColumnHeadersAsSelectors="false" 
                                                        DayCellToolTipFormat="dddd, dd MMMM, yyyy" 
                                                        NavigationPrevToolTip="เดือนก่อนหน้า" 
                                                        NavigationNextToolTip="เดือนถัดไป" 
                                                        FastNavigationNextToolTip="3 เดือนถัดไป" 
                                                        FastNavigationPrevToolTip="3 เดือนก่อนหน้า">
                                                        <ClientEvents OnDateClick="OnDateClick" OnCalendarViewChanged="OnCalendarViewChanged">
                                                        </ClientEvents>
                                                        <FastNavigationSettings EnableTodayButtonSelection="true" 
                                                            TodayButtonCaption="ไปที่วันนี้" 
                                                            OkButtonCaption="เปลี่ยน" 
                                                            CancelButtonCaption="ยกเลิก" />
                                                    </telerik:RadCalendar>
                                                </telerik:RadToolTip>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                                <div class="formList-detail">
                                    <table>
                                        <tr>
                                            <td width = "120px" valign="top">
                                                หมายเหตุเพิ่มเติม :
                                            </td>
                                            <td>
                                                <asp:Label runat="server" ID="lblRemark" AssociatedControlID="txtRemark"></asp:Label>
                                                <asp:TextBox CssClass="TextBox" ID="txtRemark" runat="server" Visible="false" TextMode="MultiLine" Height="100" Width="280px" Font-Names="Microsoft Sans Serif"></asp:TextBox>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                                <telerik:RadAjaxPanel ID="PanelPhoto" runat="server">
                                    <div class="formList-detail">
                                        <table>
                                            <tr>
                                                <td width = "120px" valign="top">
                                                    ภาพประกอบ 1 :
                                                </td>
                                                <td>
                                                    <div id="uploadFile_div" runat="server">
                                                        <input id="attachment" type="file" size="18" runat="server" name="attachment" onchange="showImage();" onkeydown="return false;" />
                                                        <asp:LinkButton ID="btnClearImage" runat="server" CssClass="LinkButton" OnClientClick="clearImage();">
                                                            <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cancel.gif" />&nbsp;&nbsp;ลบรูปภาพ
                                                        </asp:LinkButton>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width = "120px" valign="top">
                                                    ภาพประกอบ 2 :
                                                </td>
                                                <td>
                                                    <div id="Div1" runat="server">
                                                        <input id="File1" type="file" size="18" runat="server" name="attachment" onchange="showImage();" onkeydown="return false;" />
                                                        <asp:LinkButton ID="LinkButton1" runat="server" CssClass="LinkButton" OnClientClick="clearImage();">
                                                            <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cancel.gif" />&nbsp;&nbsp;ลบรูปภาพ
                                                        </asp:LinkButton>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width = "120px" valign="top">
                                                    ภาพประกอบ 3 :
                                                </td>
                                                <td>
                                                    <div id="Div2" runat="server">
                                                        <input id="File2" type="file" size="18" runat="server" name="attachment" onchange="showImage();" onkeydown="return false;" />
                                                        <asp:LinkButton ID="LinkButton2" runat="server" CssClass="LinkButton" OnClientClick="clearImage();">
                                                            <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cancel.gif" />&nbsp;&nbsp;ลบรูปภาพ
                                                        </asp:LinkButton>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </telerik:RadAjaxPanel>

                            </ul>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
             <asp:Panel CssClass="panelGrid" ID="panelGrid" runat="server" ScrollBars="Auto" Visible="true">
                <div align="center">
                    <telerik:RadGrid ID="Grid" 
                        runat="server" 
                        AutoGenerateColumns="false"
                        AllowMultiRowEdit="false" 
                        AllowMultiRowSelection="true" 
                        ShowStatusBar="true"
                        Width="580px" Height="330px" 
                        AllowPaging="true" 
                        AllowFilteringByColumn="false"
                        GroupingSettings-GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;"
                        GroupingSettings-GroupContinuedFormatString=""
                        GroupingSettings-GroupContinuesFormatString=""
                        GroupingSettings-GroupSplitFormat="" PageSize ="7" 
                        OnItemCommand="Grid_ItemCommand" align ="left">
                        <MasterTableView AllowMultiColumnSorting="True" CellSpacing="-1" GroupLoadMode="Client"
                        ShowGroupFooter="true" 
                        DataKeyNames="Seq" 
                        ClientDataKeyNames = "Seq"
                        NoMasterRecordsText="< ไม่มีข้อมูล >" 
                        GroupsDefaultExpanded="true">
                        <RowIndicatorColumn>
                            <HeaderStyle Width="20px" />
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn>
                            <HeaderStyle Width="20px" />
                        </ExpandCollapseColumn>
                        <Columns>   
                            <telerik:GridTemplateColumn AllowFiltering="false" UniqueName="Delete" HeaderText="ลบ" HeaderStyle-Width="35px" HeaderStyle-Font-Bold="false" HeaderStyle-HorizontalAlign="Center"> 
                                <FilterTemplate></FilterTemplate>
                                <ItemTemplate>
                                     <asp:ImageButton ID="cmdDelete" runat="server" 
                                        CommandName="DataDelete"
                                        ImageUrl="~/App_UI/Image/Grid/Delete.gif" 
                                        OnClientClick="javascript:return confirm('ยืนยันการลบข้อมูลที่เลือก')"
                                        ToolTip="ลบรายการ" /> 
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn DataField="Seq" 
                                HeaderText="Seq" UniqueName="Seq"
                                FilterControlWidth="100%" AutoPostBackOnFilter="true" 
                                CurrentFilterFunction="Contains" ShowFilterIcon="false" Visible="false" 
                                HeaderStyle-Font-Bold="false" HeaderStyle-HorizontalAlign="Center">
                            </telerik:GridBoundColumn>
                           <telerik:GridTemplateColumn DataField="SerialNumber"  
                                HeaderText="หมายเลขพัสดุ"
                                AutoPostBackOnFilter="true" 
                                CurrentFilterFunction="Contains" ShowFilterIcon="false"
                                FilterControlWidth="100%" UniqueName="SerialNumber" SortExpression="SerialNumber">
                                <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                <ItemStyle HorizontalAlign="Left" />
                                <ItemTemplate>
                                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="#" onclick='<%# Eval("Seq","return SeqClick( {0} );") %>' Text='<%# Eval("SerialNumber") %>'></asp:HyperLink>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn DataField="ResourceItemSeq.Name" 
                                HeaderText="รายการ" UniqueName="ResourceItemSeq.Name"
                                FilterControlWidth="100%" 
                                AutoPostBackOnFilter="true"
                                CurrentFilterFunction="Contains" 
                                ShowFilterIcon="false" 
                                HeaderStyle-Width="150px"
                                HeaderStyle-Font-Bold="false" 
                                HeaderStyle-HorizontalAlign="Center">
                            </telerik:GridBoundColumn>      
                            <telerik:GridBoundColumn DataField="Description" 
                                HeaderText="ยี่ห้อ ขนาด ลักษณะ" UniqueName="Description"
                                FilterControlWidth="100%" 
                                AutoPostBackOnFilter="true"
                                CurrentFilterFunction="Contains" 
                                ShowFilterIcon="false" 
                                HeaderStyle-Width="150px"
                                HeaderStyle-Font-Bold="false" 
                                HeaderStyle-HorizontalAlign="Center">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Quantity" 
                                HeaderText="จำนวนรับ" UniqueName="Quantity"
                                FilterControlWidth="100%" 
                                AutoPostBackOnFilter="true"
                                CurrentFilterFunction="Contains" 
                                ShowFilterIcon="false" 
                                HeaderStyle-Width="50px"
                                HeaderStyle-Font-Bold="false" 
                                HeaderStyle-HorizontalAlign="Center">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="UnitPrice" 
                                HeaderText="ราคาต่อหน่วย" 
                                UniqueName="UnitPrice"
                                FilterControlWidth="100%" 
                                AutoPostBackOnFilter="true"
                                CurrentFilterFunction="Contains" ShowFilterIcon="false" 
                                HeaderStyle-Width="50px" 
                                HeaderStyle-Font-Bold="false" 
                                ItemStyle-HorizontalAlign = "Right"
                                HeaderStyle-HorizontalAlign="Center">
                            </telerik:GridBoundColumn>

                        </Columns>
                        <PagerStyle Mode="NumericPages" AlwaysVisible="true" 
                            FirstPageToolTip="กลับหน้าแรก" LastPageToolTip="ไปหน้าสุดท้าย" 
                            NextPagesToolTip="หน้าถัดไป" NextPageToolTip="หน้าถัดไป" 
                            PrevPagesToolTip="ย้อนกลับ" PrevPageToolTip="ย้อนกลับ" />
                        </MasterTableView>
                        <GroupingSettings GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;" 
                            GroupContinuedFormatString="" GroupContinuesFormatString="" 
                            GroupSplitFormat="" />
                        <ClientSettings EnableRowHoverStyle="True">
                            <Selecting AllowRowSelect="true" />
                            <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                        </ClientSettings>
                  </telerik:RadGrid>
                </div>
            </asp:Panel>
        </div>
        </div>
                    
        </td>
    </tr>
</table>

    </asp:Panel>
    </telerik:RadPane>
    </telerik:RadSplitter>
    <telerik:RadWindowManager ID="RadWindowManager1" 
        ShowContentDuringLoad="false" 
        VisibleStatusbar="false" ReloadOnShow="true" 
        runat="server" Skin="Vista" Modal="true" 
        KeepInScreenBounds="true" Style="z-index: 7001">
        <Windows>
            <telerik:RadWindow ID="WindowDelete" runat="server" Width="660px" Height="600px" Behaviors="Default" OnClientClose="closeRadWindow">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
   </form>
</body>
</html>

